All Questions
15 questions
-1votes
3answers
250views
Issues related to grep command looping for multiple csv files
I made a for loop script as shown below, for file in *.csv do grep raxA $file > new_${file} done && mkdir raxA && mv new_* raxA && for file in *.csv do grep raxB $file > ...
1vote
4answers
944views
Sort groups of rows where field values are the same in certain columns
I have a text file like this: 1 bob A 1 jim B 1 Kate A 1 Nancy C 1 bill A 1 Jason A 2 James B 2 fill B 2 cake C 2 lucky C 2 Lucy A 2 lily B How can I order the data by column 3 within each 1 & 2 ...
0votes
2answers
2kviews
How to extract the key words containing row from an excel file?
I need to extract the key-words containing row from an excel file (.xls) as per the order specified in the given key-word file. For example I have an excel file namely genome.xls as given below, ...
1vote
1answer
1kviews
Export command output specific lines and put it into CSV file
Could you assist me how to retrieve specific lines and put it into CSV file? How to process the output via Bash and Python3? Remark: "objectID" represents each found server "An instance of Path" ...
0votes
3answers
223views
Given a list of files, some duplicates, some not, show checksum of only the duplicates
There must be an "easy" way to do this, but I can't figure out what it is. Assume you have a plain text "file.txt" which has lines in this format (md5 sums followed by filenames): ...
-1votes
1answer
60views
find in a file where sign of a column entry changes and print first line where this happens
I have multiply files, each with three columns. I would like to monitor where a given column entries first change sign (i.e negative to positive) so that I save that row where this first happens to ...
2votes
3answers
860views
Extract every 2 lines from a 40 lines file and create a new file
I have a file with 40 lines like this: 0001.Group admin_group 0001.Users adam, sam, paul, david, jennifer, harry 0002.Group Dev_group 0002.Users mike, pauli, gary, sherry 0003.Group ...
1vote
1answer
109views
Scripting for text processing: Delete a set of lines only if entire pattern matches
I want to delete a set of lines (globally) only if the entire pattern matches. Pattern Description: Line1:^[#]+ .* Line2:^[[:space:]]*$ Line3:^-[[:space:]]*$ Line4:^[[:space:]]*$ Line5:^[#]+ .*$...
2votes
2answers
2kviews
Collect all of the sar data
Task: I can sar -u > tmp.csv and I can sar -r > tmp.csv But what I need is a big table of all the sa* files of all the options. sar -r -u -S -q > tmp.csv does not quite do the job Problems ...
0votes
1answer
779views
Print output matching pattern till other pattern match
I am trying to print text after a pattern match till it matches other pattern several times in a file. I have tried to modify the script given here but failed to do it. eg. The content of file1.txt ...
1vote
1answer
92views
Transpose a 3D tensor reprensented by files
I have a 3D tensor of dimension MxNxD data object. And this data object is decomposed and stored in different files. Initially, each slice/matrix of dimension MxN (first two dimension) is saved in a ...
2votes
2answers
176views
Merging partial duplicates
I have a csv file with four columns like this aa,bb,cc,dd ee,bb,cc,dd ff,bb,cc,dd xx,11,22,33 yy,11,22,33 I'd like to turn it into: aa,ee,ff,bb,cc,dd xx,yy,11,22,33 Basically, find ...
3votes
1answer
768views
Create table with frequency of unique names retrieved from multiple .csv files
I have 32 CSV files containing fetched information from a database. I need to make a frequency table in TSV/CSV format, where the names of the rows are the name of each file, and the names of the ...
0votes
1answer
1kviews
How do I calculate the column percentage of a file?
I have a tsv file that contains some values. I want the sum of each column and total number of values and percentage values. Eg: file.tsv contains x 1 1 0 1 x x 1 x ...
4votes
1answer
378views
Count and merge consecutive patterns
I'm searching for a short snippet to find, count and merge consecutive duplicates using standard tools or a common scripting language. Say our input is: 1 2 2 2 7 22 a b b c c c c c d dd 2 2 c c And ...